var event_mgr = require("event_mgr");
var res_mgr = require("res_mgr");
var sound_mgr = require("sound_mgr");

/**
   * 初始化框架里面的每个模块，所以这个是通用的
   */
 cc.Class({
    extends: cc.Component,
    properties:{

    },

    // LIFE-CYCLE CALLBACKS:

    // 初始化框架里面的每个模块，所以这个是通用的
    onLoad() {
        cc.log("init game framework.....");
        event_mgr.init();
        this.addComponent(sound_mgr);

        console.log("==========game_mgr onLoad==========");

        cc.log("init game framework susscees");
 
        this.cur_scene = null;
    },

    start () {

    },

    enter_scene(scene) {
        if (scene === null) {
            return;
        }

        if (this.cur_scene !== null) {
            this.cur_scene.destroy(this.cur_scene !== scene);
            // this.cur_scene.destroy(true);// 测试释放资源
        }

        this.cur_scene = scene;
        scene.enter();
    },

    preload_scene(scene, on_process, on_finished) {
        scene.preload(on_process,on_finished);
    },


    // update (dt) {},
});
